<template>
  <!-- 日志详情 -->
  <el-dialog title="日志详情" v-model="logParams.visible" @open="handleOpen" width="700" :close-on-click-modal="false">
    <div class="log-detail" v-loading="loading">
      <el-form ref="ruleFormRef" :model="logParams.row" label-width="90">
        <el-form-item label="操作人：">
          <span>{{ logParams.row.createdBy || '-' }}</span>
        </el-form-item>
        <el-form-item label="操作时间：">
          <span>{{ logParams.row.createDate || '-' }}</span>
        </el-form-item>
        <el-form-item label="开始时间：">
          <span>{{ logParams.row.executeTime || '-' }}</span>
        </el-form-item>
        <el-form-item label="结束时间：">
          <span>{{ logParams.row.finishTime || '-' }}</span>
        </el-form-item>
        <el-form-item label="操作内容：">
          <span>{{ logParams.row.operationDescription || '-' }}</span>
        </el-form-item>
        <el-form-item label="参数：">
          <span>{{ logParams.row.parametersJsonString || '-' }}</span>
        </el-form-item>
        <el-form-item label="执行方法：">
          <span>{{ logParams.row.executeMethod || '-' }}</span>
        </el-form-item>
        <el-form-item label="执行结果：">
          <span>{{ logParams.row.resultJsonString || '-' }}</span>
        </el-form-item>
      </el-form>
    </div>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="emit('close')">关闭</el-button>
      </span>
    </template>
  </el-dialog>
</template>

<script setup>
import { ref, nextTick } from 'vue'
defineProps({
  logParams: {
    type: Object,
    default: () => { },
    required: true
  }
})

const emit = defineEmits(['close'])
const ruleFormRef = ref(null)
const loading = ref(false)

// 初始化弹窗
const handleOpen = () => {
  nextTick(() => {
    ruleFormRef.value.resetFields()
    console.log('初始化')
  })
}

</script>

<style lang="scss" scoped>
.log-detail {
  .el-form-item__content {
    span {
      word-break: break-all;
    }
  }
}
</style>
